The web version of Companion (Play) allows you to connect a mocked companion device while working in Unity. You can also use the web version of play to connect to a Gameboard locally.
If you navigate to the Play url with the added url paramete of a mock board ID along with the property sim set to true, you are able to see a simulator of play. This is not connected to any game, but a sandbox for testing various play interactions.
Pressing the M key twice will also reveal a Simulate button that allows the following actions:
- Show Alert Dialog (Shows with random assets as background)
- Toggle Button (Shows/Hides the last button)
- Reset PlayPanel
- Toggle Card Template (Toggles between Card, Tile, and Playing Card templates)
- Create Hand
- Set nav (Sets tab navigation to be enabled)
- Clear nav (Removes tab navigation)
- Set Top Label
- Clear Top Label
- Change Card Asset
- Reorder to front (Reorders last card to the front)
- Reorder reverse (Reverse orders the cards)
- Switch Hand
- Highlight Hand (Highlights random card)
- Remove Highlight Hand
- Destroy Hand
- Set Nav Asset
- Set Card Background Asset
- Set SelectedAsset
- Switch to Dice View
- Send results to Dice Views
- SendEmptyResult to Dice View
- Toggle Dice Selector
- Set Dice Background
- In the Gameboard prefab, update the Mock Gameboard Id to something unique.
- * This is very important. If not updated to something unique, you could potentially be connecting to someone else's game testing at the same time with the default mock id *
- Run your game in the editor
- Navigate to the following url, updating the boardId to match that set in your Gameboard prefab.
- https://play-gameboard.hosting.lastgameboard.com/?boardId={boardId}
NOTE: This works best if your game sets the property Run in Background to true, otherwise messages are only sent/received when the unity editor is focused. Edit > Project Settings > Resolution and Presentation > Resolution > Run In Background
Now your Play on the web should be connected to your game! You can now send and receive messages from the simulated Companion (Play) instance.
Enable Developer Mode
- On your Gameboard, navigate to Settings and hold down on the Gameboard internal storage indicator (long press).
- You should see a Developer menu appear and a Toast Message saying ‘You are now a developer!'.
- Click into the Developer menu and accept the connection to the board.
Find your board's Id and IP address
- Now with Developer Mode on, in the Settings look to the bottom left of the window, there you will find your board's Id and IP address.
- You can also get your board id through the SDK logs by connecting to your board and copying it from the logs for
com.lastgameboard.localboardserivce
- Connect to your board using
adb connect {BOARD_IP_ADDRESS}
- Open Android Studio and in Logcat change the device to be your gameboard, and change the debuggable process to
com.lastgameboard.localboardserivce
- Search the log for BoardId, you should see a log message similar to this, including you BoardId
onConnection ConnectionId: 31m6tskf20r79v5vq9ek32 | Type: RELAY_CLIENT | BoardId: 1234567890 | Connections size: 1
Open a drawer on your Gameboard
- This corresponds to the seat key. Seat key corresponds to order opened: 0 is the first drawer opened, 1 the second, etc.
Navigate to Play on the web
Navigate to the following url (notice it is http instead of https) on the web with the following updated:
http://play-gameboard.hosting.lastgameboard.com/?boardId={boardId}&wsUrl=ws%3A%2F%2F192.168.1.182:8000&seatKey=0
- boardId to match your your board's Id
- wsUrl to match your your board's IP address prefaced with ws:// and connected to port 8000.
- Make sure to include the backslashes encoded. So an IP address of 192.168.1.182 would be ws://192.168.1.182:8000 which would translate to ws%3A%2F%2F192.168.1.182:8000
- seatKey to match whatever drawer you have open.